package com.qeado.site.web;

import javax.servlet.http.HttpServletRequest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.qeado.admin.common.BaseConstData;
import com.qeado.common.helper.AttributeHelper;
import com.qeado.site.model.SiteBasicInfo;
import com.qeado.site.service.SiteBasicInfoManageService;

@Controller
public class SiteBasicInfoController {

	@Autowired
	private SiteBasicInfoManageService siteBasicInfoManageService;
	
	@RequestMapping("/siteInfoManage.ac")
	public ModelAndView showSiteBasicInfo(HttpServletRequest request){
		AttributeHelper.removeSessionAttribute(request, "T_");
		SiteBasicInfo siteBasicInfo = this.siteBasicInfoManageService.getSiteBasicInfo();
		return new  ModelAndView("site/site_basic_info","siteBasicInfo",siteBasicInfo);
	}
	
	@RequestMapping("/siteBasicInfoSave.ac")
	public ModelAndView saveNewSiteBasicInfo(HttpServletRequest request, SiteBasicInfo siteBasicInfo){
		siteBasicInfo.setCreator(request.getSession().getAttribute(BaseConstData.USER_ID).toString());
		this.siteBasicInfoManageService.saveSiteBasicInfo(siteBasicInfo);
		SiteBasicInfo temp = this.siteBasicInfoManageService.getSiteBasicInfo();
		return new ModelAndView("site/site_basic_info","siteBasicInfo",temp);
		
	}
	
}
